package servlet;

import com.google.gson.Gson;
import dao.ProductTypeDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@WebServlet(name = "QueryBuyShoppingServlet", value = "/QueryBuyShoppingServlet.s")
public class QueryBuyShoppingServlet extends HttpServlet {
    private ProductTypeDao dao =new ProductTypeDao();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        final List<Map<String, Object>> maps = dao.queryAllShoppingType();
        final String json = new Gson().toJson(maps);
        response.getWriter().append(json);
    }
}
